import {createApp} from "vue";
import {createPinia} from "pinia";
import App from "./App.vue";
import elementPlus from "element-plus";
import {ElLoading} from "element-plus";
import axios from "axios";
import "element-plus/dist/index.css";
import router from "./router/index.js";
let loading;
function startloding() {
  loading = ElLoading.service({
    lock: true,
    text: "正在请求中......",
    background: "rgba(0, 0, 0, 0.6)",
  });
}
axios.interceptors.request.use(
  (req) => {
    startloding();
    return req;
  },
  (error) => {
    loading.close();
    return error;
  }
);
axios.interceptors.response.use(
  (response) => {
    loading.close()
    return response;
  },
  (error) => {
    loading.close()
    return error;
  }
);
const app = createApp(App);
const pinia = createPinia();
app.use(elementPlus)
app.use(pinia);
app.use(router);
app.mount("#app")